<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <f:view beforePhase="#{addStakeholderManagedBean.initIndustryType}">
        <h:head>
            <title>Add New Stakeholder</title>
            <style type="text/css">
                .gritter-notice-wrapper {
                    left:200px;
                    top: 50px;
                }
            </style>
        </h:head>
        <h:body>
            <h:form id="formMain">
                <p:menubar autoSubmenuDisplay="true">
                    <p:submenu label="Stakeholder Management">
                        <p:menuitem value="Add Stakeholder" url="TCubeAddStakeholder.xhtml" />
                        <p:menuitem value="View All" url="TCubeViewAllStakeholder.xhtml" />
                        <p:menuitem value="Edit Info" url="TCubeEditStakeholderInfo.xhtml" />
                    </p:submenu>

                    <p:submenu label="Service Plan">
                        <p:submenu label="Service">
                            <p:menuitem value="Add Service" url="TCubeAddService.xhtml" />
                            <p:menuitem value="View All" url="TCubeViewAllService.xhtml" />
                            <p:menuitem value="Edit Info" url="TCubeEditServiceInfo.xhtml" />
                        </p:submenu>

                        <p:submenu label="Service Package">
                            <p:menuitem value="Add Package" url="TCubeAddServicePackage.xhtml" />
                            <p:menuitem value="View All" url="TCubeViewAllServicePackage.xhtml" />
                            <p:menuitem value="Edit Info" url="TCubeEditServicePackageInfo.xhtml" />
                        </p:submenu>
                    </p:submenu>
                </p:menubar>  
                <br/>
                <p:panel id="panel" header="Add New Stakeholder">
                    <p:ajaxStatus style="width:16px;height:16px;">
                        <f:facet name="start">
                            <h:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" />
                        </f:facet>
                        <f:facet name="complete">
                            <h:outputText value="" />
                        </f:facet>
                    </p:ajaxStatus>
                    <p:messages />
                    <h:panelGrid columns="3" cellpadding="10">
                        <h:outputLabel for="username" style="font-weight: bold" value="Stakeholder username: *" />
                        <h:inputText required="true" label="Event Name" requiredMessage="Stakeholder username is required." id="username" value="#{addStakeholderManagedBean.stakeholder.username}">
                        </h:inputText>
                        <p:message for="username" />

                        <h:outputLabel for="password" style="font-weight: bold" value="Password: *" />
                        <p:password feedback="true" minLength="6" required="true" label="Start Date/Time" requiredMessage="Password is required. At least 6 characters" id="password" value="#{addStakeholderManagedBean.stakeholder.password}">
                        </p:password>
                        
                        <p:message for="password" />

                        <h:outputLabel for="contactPerson" style="font-weight: bold" value="Contact Person: *" />
                        <h:inputText required="true" label="Contact Person" requiredMessage="Contact Person is required." id="contactPerson" value="#{addStakeholderManagedBean.stakeholder.corpContactPerson}">
                        </h:inputText>
                        <p:message for="contactPerson" />

                        <h:outputLabel for="corpName" style="font-weight: bold" value="Corporate name: *" />
                        <h:inputText required="true" label="Corporate name" requiredMessage="Corporate name is required." id="corpName" value="#{addStakeholderManagedBean.stakeholder.corpName}">
                        </h:inputText>
                        <p:message for="corpName" />

                        <h:outputLabel for="bizRegNumber" style="font-weight: bold" value="Business Registration Number: *" />
                        <h:inputText required="true" label="Business Registration Number" requiredMessage="Business Registration Number is required." id="bizRegNumber" value="#{addStakeholderManagedBean.stakeholder.bizRegNumber}">
                        </h:inputText>
                        <p:message for="bizRegNumber" />

                        <h:outputLabel for="houseNumber" style="font-weight: bold" value="Unit Number: " />
                        <h:inputText required="true" label="houseNumber" requiredMessage="Unit Number is required." id="houseNumber" value="#{addStakeholderManagedBean.stakeholderAddress.houseNumber}">
                        </h:inputText>
                        <p:message for="houseNumber" />

                        <h:outputLabel for="buildingName" style="font-weight: bold" value="Building name: " />
                        <h:inputText required="true" label="buildingName" requiredMessage="Building Name is required." id="buildingName" value="#{addStakeholderManagedBean.stakeholderAddress.buildingName}">
                        </h:inputText>
                        <p:message for="houseNumber" />

                        <h:outputLabel for="streetName" style="font-weight: bold" value="Street Name: " />
                        <h:inputText required="true" label="streetName" requiredMessage="Street Name is required." id="streetName" value="#{addStakeholderManagedBean.stakeholderAddress.streetName}">
                        </h:inputText>
                        <p:message for="streetName" />

                        <h:outputLabel for="postalCode" style="font-weight: bold" value="Postal Code: " />
                        <h:inputText required="true" maxlength="6" label="postalCode" requiredMessage="Postal Code is required." id="postalCode" value="#{addStakeholderManagedBean.stakeholderAddress.postalCode}">
                        </h:inputText>
                        <p:message for="postalCode" />

                        <h:outputLabel for="phoneNumber" style="font-weight: bold" value="Phone Number: " />
                        <h:inputText required="true" label="Phone Number" requiredMessage="Phone Number is required." id="phoneNumber" value="#{addStakeholderManagedBean.stakeholder.corpContactNumber}">
                        </h:inputText>
                        <p:message for="phoneNumber" />

                        <h:outputLabel for="email" style="font-weight: bold" value="Email: " />
                        <h:inputText required="true" label="Email" requiredMessage="Email is required." id="email" value="#{addStakeholderManagedBean.stakeholder.corpEmail}">
                        </h:inputText>
                        <p:message for="email" />

                        <h:outputLabel for="fax" style="font-weight: bold" value="Fax: " />
                        <h:inputText required="true" label="Fax" requiredMessage="Fax is required." id="fax" value="#{addStakeholderManagedBean.stakeholder.corpFaxNumber}">
                        </h:inputText>
                        <p:message for="fax" />

                        <p:dataTable var="industryType" value="#{addStakeholderManagedBean.industryTypeList}" selection="#{addStakeholderManagedBean.industryType}" paginator="true" rows="10">
                            <p:column selectionMode="single" />

                            <p:column headerText="Name">
                                <h:outputText value="#{industryType.name}" />
                            </p:column>

                            <p:column headerText="Description">
                                <h:outputText value="#{industryType.description}" />
                            </p:column>
                        </p:dataTable>
                    </h:panelGrid>
                    <p:commandButton id="btn" value="Create New Stakeholder" update="panel" actionListener="#{addStakeholderManagedBean.register}" ajax="true" />
                </p:panel>
            </h:form>
        </h:body>
    </f:view>
</html>
